<?php
session_start();
//connessione al database
include 'connect.php';

$titolo = $_POST['titolo'];
$testo = $_POST['testo'];
$data = date(Y.'-'.m.'-'.d);
$time = date(H.':'.i.':'.s);
$autore = $_SESSION['userid'];

$insert=mysql_query("insert into bacheca values('','$titolo','$testo','$data','$time','$autore')");

if(!$insert) {
?>
<script language="Javascript">
alert("Errore nell'inserimento");
window.location="home.php?page=aggiungipost";
</script>
<?php
}
else
{
?>
<script language="Javascript">
alert("Post inserito");
</script>
<?php
}
?>

<script language="Javascript">
browser= navigator.appName;
if (browser == "Netscape")
window.location="home.php?page=bacheca"; else window.location="home.php?page=bacheca"
</script>